<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>列表</title>
<link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
<script src="/static/layui/layui.all.js"></script>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="/static/js/webutil.js?t=123"></script>
</head>
<#import "/util/upload.ftl" as Upload>
<body>
	<div class="layui-fluid">
		<div class="layui-row">
		<div class="layui-field-box">
			<form class="layui-form" id="childMenuForm" action="">
				  <input type="hidden" name="pid" value="${menu.id!''}">
				  <input type="hidden" name="pids" value="${menu.pids!''},${menu.id!''}">
				  <input type="hidden" name="level" value="${menu.level+1}">
				  <div class="layui-form-item">
				    <label class="layui-form-label">名称</label>
				    <div class="layui-input-block">
				      <input type="text" name="name" lay-verify="required" class="layui-input">
				    </div>
				  </div>
				  <div class="layui-form-item">
				    <label class="layui-form-label">链接</label>
				    <div class="layui-input-block">
				      <input type="text" name="url" class="layui-input">
				    </div>
				  </div>
				  <div class="layui-form-item">
				    <label class="layui-form-label">权限</label>
				    <div class="layui-input-block">
				      <input type="text" name="permission" class="layui-input">
				    </div>
				  </div>
				  <div class="layui-form-item">
				    <label class="layui-form-label">图标</label>
				    <div class="layui-input-block">
				    	<input type="hidden" id="child_menu_icon_hidden" name="icon" value="" class="layui-input">
				    	<button class="layui-btn  layui-btn-primary" type="button"><i class="layui-icon" id="child_menu_icon"></i></button>
				      	<button class="layui-btn" type="button" onclick="selectIcon('child_menu_icon')">选择图标</button>
				    </div>
				  </div>
				  <div class="layui-form-item">
				    <label class="layui-form-label">排序</label>
				    <div class="layui-input-block">
				      <input type="text" name="sort" lay-verify="required" class="layui-input">
				    </div>
				  </div>
				  <div class="layui-form-item">
				    <label class="layui-form-label">是否展示</label>
				    <div class="layui-input-block">
				      <input type="radio" name="showflag" value="1" title="是" checked>
					  <input type="radio" name="showflag" value="0" title="否">
				    </div>
				  </div>
				  <div class="layui-form-item">
				    <div class="layui-input-block">
				      <button class="layui-btn" lay-submit lay-filter="*">保存</button>
				    </div>
				  </div>
				</form>
				</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
	var postUrl="/base/sysmenu/save.json";
	
	$(function(){
		<#if viewMode??>
		$('input').attr("readonly","readonly");
		$('select').attr("disabled","disabled");
		$('textarea').attr("readonly","readonly");
		$('button').attr("disabled","disabled");
		$("button").addClass("layui-btn-disabled");
		</#if>
		layui.form.render();
	});
	
	layui.form.on('submit(*)', function(formData) {
		postData(postUrl);
		return false;
	});
	
	function selectIcon(id){
		openLayer('/base/sysmenu/selectIcon.htm?id='+id, '选择图标');
	}
</script>
</html>